import {createRouter, createWebHistory} from 'vue-router'

const routes = [
  {
    path: '/',
    name: 'Index',
    redirect: {
      name: 'Web'
    }
  },
  {
    path: '/web',
    name: 'Web',
    component: () => import(/* webpackChunkName: "Web" */ '../views/Web')
  },
  {
    path: '/login',
    name: 'login',
    component: () => import(/* webpackChunkName: "Login" */ '../views/Login')
  },
  {
    path: '/admin',
    name: 'Admin',
    component: () => import(/* webpackChunkName: "Home" */ '../views/Home'),
    redirect: '/admin/users/personal',
    children: [
      {
        path: '/admin/users/personal',
        name: 'UsersPersonal',
        component: () => import(/* webpackChunkName: "UsersPersonal" */ '../views/User/personal'),
        meta: {
          title: '个人资料'
        }
      },
      {
        path: '/admin/users/password',
        name: 'UsersPassword',
        component: () => import(/* webpackChunkName: "UsersPassword" */ '../views/User/password'),
        meta: {
          title: '修改密码'
        }
      },
      {
        path: '/admin/article',
        name: 'AdminArticle',
        component: () => import(/* webpackChunkName: "AdminArticle" */ '../views/Article'),
        meta: {
          title: '文章列表'
        }
      },
      {
        path: '/admin/article/add',
        name: 'AdminArticleAdd',
        component: () => import(/* webpackChunkName: "AdminArticleAdd" */ '../views/Article/add'),
        meta: {
          title: '发布文章'
        }
      },
      {
        path: '/admin/article/update',
        name: 'AdminArticleUpdate',
        component: () => import(/* webpackChunkName: "AdminArticleUpdate" */ '../views/Article/update'),
        meta: {
          title: '修改文章'
        }
      },
      {
        path: '/admin/comment',
        name: 'AdminComment',
        component: () => import(/* webpackChunkName: "AdminComment" */ '../views/Comment'),
        meta: {
          title: '评论管理'
        }
      },
      {
        path: '/admin/fans',
        name: 'AdminFans',
        component: () => import(/* webpackChunkName: "AdminFans" */ '../views/Fans'),
        meta: {
          title: '粉丝管理'
        }
      },
      {
        path: '/admin/star',
        name: 'AdminStar',
        component: () => import(/* webpackChunkName: "AdminStar" */ '../views/Star'),
        meta: {
          title: '点赞管理'
        }
      }
    ]
  },
  {
    path: '/test',
    name: 'Test',
    component: () => import(/* webpackChunkName: "Test" */ '../views/Test'),
    meta: {
      title: 'Test'
    }
  },
  {
    path: '/map',
    name: 'Map',
    component: () => import(/* webpackChunkName: "Map" */ '../views/Map'),
    meta: {
      title: 'Map'
    }
  }
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
